package cn.cleanarch.infra.idp.uaa.core.domain.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonProperty;
import cn.cleanarch.infra.idp.database.entity.DBModel;
import org.hibernate.validator.constraints.Length;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

/**
 * 前端UI组件权限
 */
@Data
@ToString
@EqualsAndHashCode(callSuper = true)
@TableName("t_menu_permission")
public class MenuPermission extends DBModel {

  @Length(max = 255)
  private String name;

  @Length(max = 50)
  private String code;

  @Length(max = 255)
  private String type;

  private Long parentId;

  @Length(max = 255)
  private String path;

  @Length(max = 255)
  private String redirect;

  @Length(max = 255)
  private String icon;

  @Length(max = 255)
  private String component;

  @Length(max = 255)
  private String layout;

  private Boolean keepAlive;

  @Length(max = 255)
  private String method;

  @Length(max = 255)
  private String description;

  @JsonProperty("show") // 返回给前端的json时，变成show字段，后台不要用show这个数据库的关键字
  private Boolean canShow;

  private Boolean enable;

  @JsonProperty("order") // 返回给前端的json时，变成order字段，后台不要用这个数据库的关键字
  private Integer sortOrder;

}
